UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y3rYCzsKFRPeY/G6xXJGIwr50u+vwX+b9ANd3v3O66s='
WHERE
key_id = 'd60ed1c99cbc7e8b85540e18367ecbbf9cc585083e3e552ff259fc8cedc2082b'
AND (
token = 'Y3rYCzsKFRPeY/G6xXJGIwr50u+vwX+b9ANd3v3O66s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)