UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1JrNPUqsyUEYxD1gIIKve+kc0sG6yeWYy28B9xPpAb0='
WHERE
key_id = 'c2172a0ac06ce6ec005232619f88bd816a4e47674555cfdc0ac280e4af3ca6fb'
AND (
token = '1JrNPUqsyUEYxD1gIIKve+kc0sG6yeWYy28B9xPpAb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)