UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mmTKnfnl4w1s3eddJYZjJ+YzmFlads2UcK0fZ88sbRc='
WHERE
key_id = 'c4c7ed6319c3adc1f0942b88a9f6a6a3a1ce6352ff5f715198540aa7673b1d38'
AND (
token = 'mmTKnfnl4w1s3eddJYZjJ+YzmFlads2UcK0fZ88sbRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)