UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y1h1kVxYFO0NqLOcIFUy0St6yUSsiQnMUmATiYg2C3Y='
WHERE
key_id = '6594f7d953bf19a6357a5e7bba633861cf0295682a57e9ba23284201489fffd6'
AND (
token = 'Y1h1kVxYFO0NqLOcIFUy0St6yUSsiQnMUmATiYg2C3Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)