UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ihiWQP411gk30rUty+JCKZaWQlAYhLO36ko1k0cYK9w='
WHERE
key_id = 'e548a57a1e8d349516c4e636883d82e1ed9dfd140bc5eaa28fbb7716e6bae838'
AND (
token = 'ihiWQP411gk30rUty+JCKZaWQlAYhLO36ko1k0cYK9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)