UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nYYVwJALryCp4EtECNDE1OIYTbB0KxLbKewpvmJ3Jpk='
WHERE
key_id = '8bfdccaf37096b3d601f63bd179c4f0a70d2957f46a71c2a08eb00dcfd6c9c9c'
AND (
token = 'nYYVwJALryCp4EtECNDE1OIYTbB0KxLbKewpvmJ3Jpk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)