UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OnaQExGsk91A7h8kfg9TetnfyG2FcUshCJvRRuLZUHM=' 
WHERE 
  key_id = '7231b3160b92e43d753c8b523b24021e049606c85886b500f339d763d5175291' 
  AND (
    token = 'OnaQExGsk91A7h8kfg9TetnfyG2FcUshCJvRRuLZUHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040