UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'whcyhUpcvrE9JSRJgPrsPbaq0gvQXAtoNpP3TYh4jVY='
WHERE
key_id = '8f17ba70a53ee6ff0cf760f8920aedd1720762d4a716948850bbcd7c4470f4be'
AND (
token = 'whcyhUpcvrE9JSRJgPrsPbaq0gvQXAtoNpP3TYh4jVY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)