UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '08izVJGS655Nsx6NgO/qVY+e6Vy/RRmfIFwaWfckflk=' 
WHERE 
  key_id = '3e14167b5501c00011b9d0a002e7fe1a19e9c222e798881ad94b88823d4078f2' 
  AND (
    token = '08izVJGS655Nsx6NgO/qVY+e6Vy/RRmfIFwaWfckflk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047