UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N5EmJNJ+SM68KgHP77oWoFvDizWlP1/4rcHHyXJrpQw=' 
WHERE 
  key_id = 'b9626922718b8a44561eae13840512dfdd13082213f376e7ee8eab3110d955e1' 
  AND (
    token = 'N5EmJNJ+SM68KgHP77oWoFvDizWlP1/4rcHHyXJrpQw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049