UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aRIYmeguaaA5kOyTWvD1m8szR+kcG8YNR5qG+5sw8dY='
WHERE
key_id = 'd66540d7c2b85b94460da4e05a182b70a65cd15ac439770a6a0f005e67a53241'
AND (
token = 'aRIYmeguaaA5kOyTWvD1m8szR+kcG8YNR5qG+5sw8dY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)