UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1QeFQNR+hblUCxfG7B7qWZ2FzrrIOEGD17gohO6r6ws=' 
WHERE 
  key_id = '15856eaf21605f512ef0d22357b611df70a691a3fdc4f14e4e69b86425764b5c' 
  AND (
    token = '1QeFQNR+hblUCxfG7B7qWZ2FzrrIOEGD17gohO6r6ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047