UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O6uZaaoN2HaUo8qHyTKvv8zwMQSqycxxBxod8Zdps2s='
WHERE
key_id = 'f07c559838c98bef386f983a8f04b28211b656bf39660c9ffb1d8c522372cfda'
AND (
token = 'O6uZaaoN2HaUo8qHyTKvv8zwMQSqycxxBxod8Zdps2s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)