UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ZMilCIPrYT7a79jXzIrHY/ysqsh07FvLvLGJXfAYnU=' 
WHERE 
  key_id = '8dbb198198c26520cc1f713afaebcf9022f2720dd4bd43586d63eca7362183e9' 
  AND (
    token = '8ZMilCIPrYT7a79jXzIrHY/ysqsh07FvLvLGJXfAYnU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026