UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o4lOlAU5fhtvY0JjWVGh7dq2pTptJbbcOafGa9+dE14='
WHERE
key_id = 'c41dded1d1be9227d115fa7a17f36e3710f3fa2ace955ba3c07300e4aea301ec'
AND (
token = 'o4lOlAU5fhtvY0JjWVGh7dq2pTptJbbcOafGa9+dE14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)