UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KgMGh8LyYwuYiZQVg/1QYAiX8N52FL65KloR5QHP0Ds=' 
WHERE 
  key_id = '31c2aad110cfb2c20d91ba523c955c1a1f715dd9d92da28c4a9478fe98d2e7ec' 
  AND (
    token = 'KgMGh8LyYwuYiZQVg/1QYAiX8N52FL65KloR5QHP0Ds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044