UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cawccqpea2gTFBDA6HAY7aTcvYYsneDUzA3PFJ3gDqU=' 
WHERE 
  key_id = '6371eaa5ca14a09682c3b62e33fed5ea140ce0291306c8627e0a04cfdd1697a8' 
  AND (
    token = 'Cawccqpea2gTFBDA6HAY7aTcvYYsneDUzA3PFJ3gDqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055