UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kGzDgUAfPMJzoCH0BgSAmlV8eapj/9U7NQgfcAYBYsc='
WHERE
key_id = '4eb5bdc6685c6be106ef67493178de1a3ba089251ea10204d116ad360e37628a'
AND (
token = 'kGzDgUAfPMJzoCH0BgSAmlV8eapj/9U7NQgfcAYBYsc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)