UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vi3S9tYi7PukgPcOUjh/MdRwMb9p86kT8RPLeV05mTs=' 
WHERE 
  key_id = '31954ad304e956bf158b4f2492d06b3a2084062399169da0c57c2e14c836dbb7' 
  AND (
    token = 'vi3S9tYi7PukgPcOUjh/MdRwMb9p86kT8RPLeV05mTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028