UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ty3BkFEzEFibKnyy9JgHDEb1O9C1d+9coOZqo9/3cG4=' 
WHERE 
  key_id = '788e14211180edb48d9823fea9cb1aa930401130e013b4435750b10d318dd2dd' 
  AND (
    token = 'ty3BkFEzEFibKnyy9JgHDEb1O9C1d+9coOZqo9/3cG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040