UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vhtV+GDNjDjlL4v17AVinPevbzEpQta7IMHPzqw08zs=' 
WHERE 
  key_id = 'ac9a2f7488f87f8dd0524745246ca2db728993826716b965577e96cf127eb137' 
  AND (
    token = 'vhtV+GDNjDjlL4v17AVinPevbzEpQta7IMHPzqw08zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039