UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TEV8NmDdJgNoCB/jjqiGgk+rSJcXbYNQoaunbePw0tc='
WHERE
key_id = 'eb73deb2dc1aad6060a63eca57414dcc31eab799c2efe1dc4ecc0f8198ceb22a'
AND (
token = 'TEV8NmDdJgNoCB/jjqiGgk+rSJcXbYNQoaunbePw0tc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)