UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JUndEWGPFN5mvnTPazWR4UsXRHZxiPI9Hg1hc2MZPb0='
WHERE
key_id = '8c2e9480646b7727ca10bcdc1bcd0af383a41f5039ea12b0f4ea40368b999b1e'
AND (
token = 'JUndEWGPFN5mvnTPazWR4UsXRHZxiPI9Hg1hc2MZPb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)