UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7GKI23bfIUC70Mb8Z3iQJ33ADA0pNat8R6x5Syui4HI='
WHERE
key_id = 'c10eac431ce512f77bd24e7b32e8a06d4032bc4e937051d05133cc4cd7fc5a25'
AND (
token = '7GKI23bfIUC70Mb8Z3iQJ33ADA0pNat8R6x5Syui4HI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)