UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2aXfbTzif2vDtfuek9MR7SshACSfYpqcfhZdAIAF9ho='
WHERE
key_id = '3f99634e617f6df64981fffc16d2c0085010401e988913a0d125fe971b58d3eb'
AND (
token = '2aXfbTzif2vDtfuek9MR7SshACSfYpqcfhZdAIAF9ho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)