UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6hL5kuH5ZPQv3crO1QYoAHSSkKmXTZuNG5SEDVUwNaU='
WHERE
key_id = 'bf5982b1feb2a97fd3986e1c5e6c41c31f865e95b37dde54300fe663ef57b025'
AND (
token = '6hL5kuH5ZPQv3crO1QYoAHSSkKmXTZuNG5SEDVUwNaU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)