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