UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fEwV1UIJdiwBYMdTwu/0c0nKfW+PINGQjsCeWfSMmEU='
WHERE
key_id = 'c76140c1427b6ed514300a1c0f8b1d4093a08991f1f8a87d55a67ec678d57ac2'
AND (
token = 'fEwV1UIJdiwBYMdTwu/0c0nKfW+PINGQjsCeWfSMmEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)