UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a6SG1OuCfhwm2MiA127fQ8JMHv+CNklEpTdTLNe9cns='
WHERE
key_id = '1e21d02363fd80810d1d44e101386fb6ec8f79cfd1e8dba9c3c3afa2cfaa2faa'
AND (
token = 'a6SG1OuCfhwm2MiA127fQ8JMHv+CNklEpTdTLNe9cns='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)