UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UqW4eiyIo1zRji9Rg7jUgwHeHPt5Ryh8lK48j446rr8='
WHERE
key_id = '7209df4690eb057160f9b14717fdefed29a86d63f379d575835e92c4b57b6a02'
AND (
token = 'UqW4eiyIo1zRji9Rg7jUgwHeHPt5Ryh8lK48j446rr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)