UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r9S2x3ViPCc7+vzrXhSYGeAleK1sayp24satbbn8T+E='
WHERE
key_id = 'fb7f37de2daea29a7f5128288e6dc57940b68b66010c247ba6d67d80e733f9b8'
AND (
token = 'r9S2x3ViPCc7+vzrXhSYGeAleK1sayp24satbbn8T+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)