UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gnIW8lnGaskrLXsAW31nljPoQGPUz7tSfeyJsEFJLM4='
WHERE
key_id = '7e42732c3ea4231f1becd9a02bf1ae0057ac884baf0dc1198d9e1dbc961f1211'
AND (
token = 'gnIW8lnGaskrLXsAW31nljPoQGPUz7tSfeyJsEFJLM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)