UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mw0L8nxV6+osSxzuarG3kFU0jiLrOn5EdPRagWpXRg8='
WHERE
key_id = 'a39405e91a5a454dc736d035fc01db520e4d637ef7576455c2dd0fdefa27ec8a'
AND (
token = 'Mw0L8nxV6+osSxzuarG3kFU0jiLrOn5EdPRagWpXRg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)