UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xnvY4GGpaYPqCtx7HLy6+xRFEhc7jnwae8n+nXzd7jY='
WHERE
key_id = 'e0c795a8e64c0fc92b7cfaf5f9c5193be7c5c1d8e73d4345d754724a5c05c049'
AND (
token = 'xnvY4GGpaYPqCtx7HLy6+xRFEhc7jnwae8n+nXzd7jY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)