UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vuOEO7mwuoxk8obrAdtzXA7ZxMvn6ZtH82SuDvQYmnQ=' 
WHERE 
  key_id = '085d15dfa21acb8884f00a4b55c246559238e871438b113ff82df342cff4961b' 
  AND (
    token = 'vuOEO7mwuoxk8obrAdtzXA7ZxMvn6ZtH82SuDvQYmnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061