UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DUm4t8Dnt+eT43upqQk1giZJZ3HZf22wK3JJ1mf1OfA=' 
WHERE 
  key_id = '039fcc5b3e6dbe368967a8b0407ab44cfc3f3e91ee02de08f688b97c5f16caeb' 
  AND (
    token = 'DUm4t8Dnt+eT43upqQk1giZJZ3HZf22wK3JJ1mf1OfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037