UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K2LZeNplwCrpwIh1w+5BZYnnkmIS7m99iT+sgKKw7LA='
WHERE
key_id = 'a39dcd029b5cd19ef6d02d5d037c2c32d66557b31ef173c52594f3f6ceb6a656'
AND (
token = 'K2LZeNplwCrpwIh1w+5BZYnnkmIS7m99iT+sgKKw7LA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)