UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'slcZKIktlPJUwS5Ccu1JznLkqy7bQO9n24YHNKNbB5s='
WHERE
key_id = '5e82e20eecd4684d137c8b35cda2ac4dcc6378dd70527cc3caedf678b4582c39'
AND (
token = 'slcZKIktlPJUwS5Ccu1JznLkqy7bQO9n24YHNKNbB5s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)