UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bf8VHX3AqxYQGCbqOpsGxg0UwJ4FrwplOS995fB4Irk='
WHERE
key_id = '792377e4bf6160ac3119d28c364ee5660072e0305d77fc63ecf11998afbd040a'
AND (
token = 'Bf8VHX3AqxYQGCbqOpsGxg0UwJ4FrwplOS995fB4Irk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)