UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XOIUpMiJmW/dQq2lAbNWfRhBa6tSfXpn23gsWGlBCQ8='
WHERE
key_id = 'f047cf1c274b03283ca8c5a9507edd8034f19e6fe3b87bd10315f4eb54c30cf9'
AND (
token = 'XOIUpMiJmW/dQq2lAbNWfRhBa6tSfXpn23gsWGlBCQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)